#ifndef PERMUTATIONENCODEDSOLUTION_H_
#define PERMUTATIONENCODEDSOLUTION_H_

#include <vector>
#include "../Solution.h"
#include "../../Exception/GA_Exception.h"

using namespace std;

/** Implementation of a permutation encoded solution.
 */
class PermutationEncodedSolution : public Solution
{
    public: 
        PermutationEncodedSolution();
        PermutationEncodedSolution(vector<int>);   /**< Constructor that allows for a prebuild solution vector  */
        void clone(PermutationEncodedSolution*);   /**< Returns a copy of the object   DEPRECATED?              */
        vector<int> getSolution();                 /**< Returns the stored solution                             */
        void setSolution(vector<int>);             /**< Sets the stored solution to the one provided            */
        Solution* clone();                         /**< Returns a pointer to a copy of the object               */
        const int& operator[](int index) const;    /**< Implementation of the [] operator for the solution      */
        int& operator[](int index);                /**< Implementation of the [] operator for the solution      */
        unsigned int size() const;                 /**< Returns the size of the contained solution              */
        void mutate();                             /**< Mutates the solution                                    */
        void fillWithRandomPermutation(int, int);  /**< Generates a random permutation of numbers               */
        void randomizeContentOrder();              /**< Shuffles the elements in this permutation into a random order */
        ostream& outputSolution(ostream &);        /**< Outputs the solution in a readable format               */
        int getElement(int) const;                 /**< Returns the element at the given index                  */
        void setElement(int, int);                 /**< Sets the element at the given index to the given value  */
        bool hasElement(int);                      /**< Checks to see if the solution contains the given element*/
        void addElement(int);                      /**< Adds the given element to the solution                  */
        void removeElement(int);                   /**< Removes the given element from the solution             */
        SolutionType getSerializationIdentifyer();       /**< Returns the serialization identifyer used by the solution factory */
        
    protected:
        vector<int> chromosome;                    /**< Vector containing the actual permutation                */
        vector<int>::iterator findElement(int);
};


#endif /*PERMUTATIONENCODEDSOLUTION_H_*/
